﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic;

namespace MyDesktopPetDemo
{
	public partial class FormLaunchpad : Form
	{
		public FormLaunchpad()
		{
			InitializeComponent();

			LaunchpadService.Init();
			listBox1.DataSource = LaunchpadService.Dests;
		}

		private void textBox1_TextChanged(object sender, EventArgs e)
		{
			listBox1.DataSource = LaunchpadService.Filter(textBox1.Text.Trim());
		}

		private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
		{
			if (listBox1.SelectedItem is LaunchDest dest)
			{
				dest.Launch();
			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			LaunchpadService.ChangePath(Interaction.InputBox("输入新路径"));
		}
	}
}
